#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "USART1.h"
#include "key.h"

uint8_t Key;

int main(void)
{ 
	OLED_Init();
  USART1_Init();
	key_Init();
	OLED_ShowString(1,1,"TXPacket:");
	OLED_ShowString(3,1,"TXPacket:");
  TXPacket[0]=0X01;
	TXPacket[1]=0X02;
	TXPacket[2]=0X03;
	TXPacket[3]=0X04;
	
	
	while(1)
 {
	 Key=key_GetNum();
	 if(Key==2)
   {
		 TXPacket[0]++;
		 TXPacket[1]++;
		 TXPacket[2]++;
		 TXPacket[3]++;
		 USART1_SendPacket();
		 OLED_ShowHexNum(2,1,TXPacket[0],2);
		 OLED_ShowHexNum(2,4,TXPacket[1],2);
		 OLED_ShowHexNum(2,7,TXPacket[2],2);
		 OLED_ShowHexNum(2,10,TXPacket[3],2);
		 
   }
	if(USART1_GetRXFlag()==1)
  {
		OLED_ShowHexNum(4,1,RXPacket[0],2);
		OLED_ShowHexNum(4,4,RXPacket[1],2);
		OLED_ShowHexNum(4,7,RXPacket[2],2);
		OLED_ShowHexNum(4,10,RXPacket[3],2);
	}
 }
 }

